package bb.lanxing.model.jsonlocal;

import com.github.mikephil.charting.utils.Utils;
import bb.lanxing.calc.data.CadencePoint;
import bb.lanxing.calc.data.GpsPoint;
import bb.lanxing.calc.data.HeartratePoint;
import bb.lanxing.calc.data.SourcePoint;
import bb.lanxing.model.database.Trackpoint;
import bb.lanxing.util.CommonUtil;

public class JPoint {
    private double ac;
    private double al;
    private double atm;
    private double be;
    private int ca;
    private double distance;
    private long duration;
    private double eleGain;
    private double eleLoss;
    private int hr;
    private long id;
    private double la;
    private double lo;
    private int pointType;
    private String powerExt;
    private double pw;
    private double sp;
    private double te;
    private long tt;
    private long wi;
    private int wr;

    public static JPoint create(Trackpoint trackpoint) {
        JPoint jPoint = new JPoint();
        jPoint.setAc(trackpoint.getAccuracy());
        jPoint.setAl(trackpoint.getAltitude());
        jPoint.setBe(trackpoint.getBearing());
        jPoint.setLa(trackpoint.getLatitude());
        jPoint.setLo(trackpoint.getLongitude());
        jPoint.setSp(trackpoint.getSpeed());
        jPoint.setTt(trackpoint.getTime());
        jPoint.setId(trackpoint.getId());
        jPoint.setWi(trackpoint.getWorkoutId());
        jPoint.setCa(trackpoint.getCadence());
        jPoint.setWr(trackpoint.getWheelRpm());
        jPoint.setHr(trackpoint.getHeartrate());
        jPoint.setAtm(trackpoint.getPressure());
        jPoint.setTe(trackpoint.getTemperature());
        jPoint.setPw(trackpoint.getPower());
        jPoint.setPowerExt(trackpoint.getPowerExt());
        jPoint.setDistance(trackpoint.getDistance());
        jPoint.setDuration(trackpoint.getDuration());
        jPoint.setEleGain(trackpoint.getElevationGain());
        jPoint.setEleLoss(trackpoint.getElevationLoss());
        jPoint.setPointType(trackpoint.getPointType());
        return jPoint;
    }

    public SourcePoint toSourcePoint(int i, int i2, int i3) {
        SourcePoint sourcePoint = new SourcePoint();
        sourcePoint.setTimestamp(this.tt);
        sourcePoint.setSpeed(this.sp);
        sourcePoint.setAltitude(this.al);
        sourcePoint.setPower((float) this.pw);
        sourcePoint.setPowerExt(this.powerExt);
        if (this.la > Utils.DOUBLE_EPSILON && this.lo > Utils.DOUBLE_EPSILON) {
            GpsPoint gpsPoint = new GpsPoint();
            gpsPoint.setSpeed((float) this.sp);
            gpsPoint.setLatitude(this.la);
            gpsPoint.setLongitude(this.lo);
            gpsPoint.setAltitude(this.al);
            gpsPoint.setBearing((float) this.be);
            gpsPoint.setTimestamp(this.tt);
            gpsPoint.setSource(i);
            sourcePoint.setGpsPoint(gpsPoint);
        }
        if (this.ca > 0 || this.atm > Utils.DOUBLE_EPSILON || this.te > Utils.DOUBLE_EPSILON) {
            CadencePoint cadencePoint = new CadencePoint();
            cadencePoint.setSumCadence(1);
            cadencePoint.setPressure((int) this.atm);
            cadencePoint.setRealPressure((float) this.atm);
            cadencePoint.setTemperature((int) this.te);
            cadencePoint.setRealTemperature((float) this.te);
            cadencePoint.setWheelRpm(this.wr);
            cadencePoint.setCadence(this.ca);
            cadencePoint.setSpeed(this.sp);
            cadencePoint.setSource(i2);
            cadencePoint.setAltitude((float) this.al);
            sourcePoint.setCadencePoint(cadencePoint);
        }
        if (this.hr > 0) {
            HeartratePoint heartratePoint = new HeartratePoint();
            heartratePoint.setHeartrate(this.hr);
            heartratePoint.setSource(i3);
            sourcePoint.setHeartratePoint(heartratePoint);
        }
        return sourcePoint;
    }

    public double getAc() {
        return this.ac;
    }

    public void setAc(double d) {
        this.ac = d;
    }

    public double getAl() {
        return this.al;
    }

    public void setAl(double d) {
        this.al = d;
    }

    public double getBe() {
        return this.be;
    }

    public void setBe(double d) {
        this.be = d;
    }

    public double getLa() {
        return this.la;
    }

    public void setLa(double d) {
        this.la = d;
    }

    public double getLo() {
        return this.lo;
    }

    public void setLo(double d) {
        this.lo = d;
    }

    public double getSp() {
        return this.sp;
    }

    public void setSp(double d) {
        this.sp = d;
    }

    public long getTt() {
        return this.tt;
    }

    public void setTt(long j) {
        this.tt = j;
    }

    public long getId() {
        return this.id;
    }

    public void setId(long j) {
        this.id = j;
    }

    public long getWi() {
        return this.wi;
    }

    public void setWi(long j) {
        this.wi = j;
    }

    public int getCa() {
        return this.ca;
    }

    public void setCa(int i) {
        this.ca = i;
    }

    public int getWr() {
        return this.wr;
    }

    public void setWr(int i) {
        this.wr = i;
    }

    public int getHr() {
        return this.hr;
    }

    public void setHr(int i) {
        this.hr = i;
    }

    public double getAtm() {
        return this.atm;
    }

    public void setAtm(double d) {
        this.atm = d;
    }

    public double getTe() {
        return this.te;
    }

    public void setTe(double d) {
        this.te = d;
    }

    public double getPw() {
        return this.pw;
    }

    public void setPw(double d) {
        this.pw = d;
    }

    public String getPowerExt() {
        return this.powerExt;
    }

    public void setPowerExt(String str) {
        this.powerExt = str;
    }

    public double getDistance() {
        return this.distance;
    }

    public void setDistance(double d) {
        this.distance = d;
    }

    public long getDuration() {
        return this.duration;
    }

    public void setDuration(long j) {
        this.duration = j;
    }

    public double getEleGain() {
        return this.eleGain;
    }

    public void setEleGain(double d) {
        this.eleGain = d;
    }

    public double getEleLoss() {
        return this.eleLoss;
    }

    public void setEleLoss(double d) {
        this.eleLoss = d;
    }

    public int getPointType() {
        return this.pointType;
    }

    public void setPointType(int i) {
        this.pointType = i;
    }
}
